package com.wisdytech.common.utils;


import com.github.pagehelper.PageInfo;
import com.wisdytech.common.bean.StandardTableResult;
import com.wisdytech.linkdcs.energy.model.EquipmentEnergy;
import com.wisdytech.linkdcs.energy.model.EquipmentEnergyRecord;
import com.wisdytech.linkdcs.energy.vo.EquipmentEnergyRecordVO;
import com.wisdytech.linkdcs.energy.vo.EquipmentEnergyVO;
import com.wisdytech.linkdcs.equipLifeCycle.maintain.model.*;
import com.wisdytech.linkdcs.equipLifeCycle.maintain.vo.*;
import com.wisdytech.linkdcs.equipLifeCycle.malfunction.model.TPReplaceTemp;
import com.wisdytech.linkdcs.equipment.model.*;
import com.wisdytech.linkdcs.equipment.vo.*;
import com.wisdytech.linkdcs.factory.model.Area;
import com.wisdytech.linkdcs.factory.model.Factory;
import com.wisdytech.linkdcs.factory.model.ProductionLine;
import com.wisdytech.linkdcs.factory.model.Shop;
import com.wisdytech.linkdcs.factory.vo.AreaVO;
import com.wisdytech.linkdcs.factory.vo.FactoryVO;
import com.wisdytech.linkdcs.factory.vo.ProductionLineVO;
import com.wisdytech.linkdcs.factory.vo.ShopVO;
import com.wisdytech.linkdcs.log.model.SysLog;
import com.wisdytech.linkdcs.log.vo.SysLogVO;
import com.wisdytech.linkdcs.partLife.model.KeyPart;
import com.wisdytech.linkdcs.partLife.model.ModelPart;
import com.wisdytech.linkdcs.partLife.model.Part;
import com.wisdytech.linkdcs.partLife.model.PartReplace;
import com.wisdytech.linkdcs.partLife.vo.*;
import com.wisdytech.linkdcs.system.model.*;
import com.wisdytech.linkdcs.system.vo.*;
import com.wisdytech.linkdcs.video.model.EquipmentVideo;
import com.wisdytech.linkdcs.video.vo.EquipmentVideoVO;

import java.util.List;

//import com.wisdytech.linkdcs.log.model.SysLog;
//import com.wisdytech.linkdcs.log.vo.SysLogVO;


/**
 * 
 * <p>ClassName: DateTransformUtil</p>
 * <p>Description: 数据对象转换类 主要对于业务数据对象进行转换</p>
 * <p>Author: PC</p>
 * <p>Date: 2017-9-18</p>
 */
public class DataTransformUtil {
    
    /**
     * 
     * <p>Description: 将pageInfo分页对象转换为前台table标准返回值</p>
     * @param pageInfo 分页信息
     * @return 表格标准返回值
     */
    public static <T> StandardTableResult<T> changePageInfo2Table(PageInfo<T> pageInfo){
        
        StandardTableResult<T> tableResult=new StandardTableResult<T>();
        tableResult.setTotal(pageInfo.getTotal());
        tableResult.setRows(pageInfo.getList());
        
        return tableResult;
    }
    
    public static UserVO changeUser2UserVO(SysUser sysUser){
        UserVO userVO =new UserVO();
        userVO.setPkId(sysUser.getPkId());
        userVO.setUsername(sysUser.getUsername());
        userVO.setTruename(sysUser.getTruename());
        userVO.setWorkNo(sysUser.getWorkNo());
        userVO.setMobile(sysUser.getMobile());
        userVO.setTelephone(sysUser.getTelephone());
        userVO.setAddress(sysUser.getAddress());
        userVO.setEnabled(sysUser.getEnabled());
        userVO.setRoleNameStr(sysUser.getRoleNameStr());
        userVO.setEmail(sysUser.getEmail());
        userVO.setCreateDate(sysUser.getCreateDate());
        userVO.setWechatName(sysUser.getWechatName());
        userVO.setRoleNameStr(sysUser.getRoleNameStr());
        return userVO;
    }
    
    public static UserUpdateVO changeUser2UserUpdateVO(SysUser sysUser){
        UserUpdateVO userUpdateVO =new UserUpdateVO();
        userUpdateVO.setPkId(sysUser.getPkId());
        userUpdateVO.setUsername(sysUser.getUsername());
        userUpdateVO.setTruename(sysUser.getTruename());
        userUpdateVO.setWorkNo(sysUser.getWorkNo());
        userUpdateVO.setMobile(sysUser.getMobile());
        userUpdateVO.setTelephone(sysUser.getTelephone());
        userUpdateVO.setAddress(sysUser.getAddress());
        userUpdateVO.setEnabled(sysUser.getEnabled());
        userUpdateVO.setRoleNameStr(sysUser.getRoleNameStr());
        
        userUpdateVO.setEmail(sysUser.getEmail());
        userUpdateVO.setCreateDate(sysUser.getCreateDate());
        userUpdateVO.setWechatName(sysUser.getWechatName());
        userUpdateVO.setPassword(sysUser.getPassword());
        userUpdateVO.setRoleId(sysUser.getRoleId());
        //TODO 角色没有加
        return userUpdateVO;
    }

    public static RoleVO changeUser2UserVO(SysRole sysRole) {
        RoleVO roleVO = new RoleVO();
        roleVO.setPkId(sysRole.getPkId());
        roleVO.setRoleName(sysRole.getRoleName());
        roleVO.setRoleType(sysRole.getRoleType());
        roleVO.setRemark(sysRole.getRemark());
        roleVO.setCreateDate(sysRole.getCreateDate());
        return roleVO;
    }

    public static ResourceVO changeUser2UserVO(SysResource sysResource) {
        ResourceVO resourceVO = new ResourceVO();
        resourceVO.setPkId(sysResource.getPkId());
        resourceVO.setParentId(sysResource.getParentId());
        resourceVO.setResCode(sysResource.getResCode());
        resourceVO.setResName(sysResource.getResName());
        resourceVO.setResOrder(sysResource.getResOrder());
        resourceVO.setResType(sysResource.getResType());
        resourceVO.setRemark(sysResource.getRemark());
        resourceVO.setCreateDate(sysResource.getCreateDate());
        return resourceVO;
    }

    public static LoginVO changeUser2UserVO(SysLoginInfo loginInfo) {
        LoginVO loginVO = new LoginVO();
        loginVO.setPkId(loginInfo.getPkId());
        loginVO.setUserName(loginInfo.getUserName());
        loginVO.setTrueName(loginInfo.getTrueName());
        loginVO.setModuleName(loginInfo.getModuleName());
        loginVO.setIpAddress(loginInfo.getIpAddress());
        loginVO.setLoginTime(loginInfo.getLoginTime());
        return loginVO;
    }

    public static DictIdxVO changeUser2UserVO(SysDictIdx sysDictIdx) {
        DictIdxVO dictIdxVO = new DictIdxVO();
        dictIdxVO.setPkId(sysDictIdx.getPkId());
        dictIdxVO.setDictKey(sysDictIdx.getDictKey());
        dictIdxVO.setDictName(sysDictIdx.getDictName());
        dictIdxVO.setRemark(sysDictIdx.getRemark());
        return null;
    }

    public static DictVO changeUser2UserVO(SysDict sysDict) {
        DictVO dictVO = new DictVO();
        dictVO.setPkId(sysDict.getPkId());
        dictVO.setDictValue(sysDict.getDictValue());
        dictVO.setDictKey(sysDict.getDictKey());
        dictVO.setDictSort(sysDict.getDictSort());
        dictVO.setRemark(sysDict.getRemark());
        return dictVO;
    }
    
    public static EquipmentModelVO changeModelVO(EquipModel model) {
        EquipmentModelVO modelVO = new EquipmentModelVO();
        modelVO.setPkId(model.getPkId());
        modelVO.setModelCode(model.getModelCode());
        modelVO.setModelType(model.getModelType());
        modelVO.setSupplier(model.getSupplier());
        modelVO.setCode(model.getCode());
        modelVO.setEcRoute(model.getEcRoute());
        modelVO.setParamName(model.getParamName());
        modelVO.setParamId(model.getParamId());
        modelVO.setType(model.getCollectionType());
        modelVO.setSupplierName(model.getSupplierName());
        
        modelVO.setOperationList(model.getOperationList());
        return modelVO;
    }
    
    public static EquipmentParamVO changeParamVO(CollectionParam param) {
        EquipmentParamVO paramVO = new EquipmentParamVO();
        paramVO.setPkId(param.getPkId());
        paramVO.setModelCode(param.getModelCode());
        paramVO.setModelType(param.getModelType());
        paramVO.setOperationName(param.getOperationName());
        paramVO.setOperationId(param.getOperationId());
        paramVO.setParamName(param.getParamName());
        paramVO.setPlcAddr(param.getPlcAddr());
        paramVO.setProcessRange(param.getProcessRange());
        
        paramVO.setIsAutoAlarm(param.getIsAutoAlarm());
        paramVO.setAutoAlarmName(param.getAutoAlarmName());
        
        paramVO.setEnlargeNum(param.getEnlargeNum());
        paramVO.setDataType(param.getDataType());
        paramVO.setRwAttr(param.getRwAttr());
        
        
        paramVO.setDatabaseParamAddr(param.getDatabaseParamAddr());
        paramVO.setUpperDefinition(param.getUpperDefinition());
        paramVO.setUpperParamField(param.getUpperParamField());
        paramVO.setUpperParamName(param.getUpperParamName());
//        paramVO.setFileAddr(param.getFileAddr());
        paramVO.setFileColumn(param.getFileColumn());
        paramVO.setFileIgnoreFirst(param.getFileIgnoreFirst());
        paramVO.setFileName(param.getFileName());
        paramVO.setFileType(param.getFileType());
        paramVO.setCollectionType(param.getCollectionType());
        paramVO.setParamCode(param.getParamCode());
        paramVO.setSpcValue(param.getSpcValue());
        paramVO.setDataType(param.getDataType());
        paramVO.setDataLength(param.getDataLength());
        paramVO.setParamField(param.getParamField());
        paramVO.setDecimalPos(param.getDecimalPos());

        return paramVO;
    }
    
    public static EquipmentParamViewVO changeParamViewVO(CollectionParam param) {
        EquipmentParamViewVO paramViewVO = new EquipmentParamViewVO();
        paramViewVO.setPkId(param.getPkId());
        paramViewVO.setEmModel(param.getModelCode());
        paramViewVO.setEmModelType(param.getModelType());
        paramViewVO.setParamName(param.getParamName());
        paramViewVO.setShowLevel(param.getShowLevel());
        
        paramViewVO.setStartValue(param.getStartValue());
        paramViewVO.setEndValue(param.getEndValue());
        paramViewVO.setStartThreshold(param.getStartThreshold());
        paramViewVO.setEndThreshold(param.getEndThreshold());
        paramViewVO.setSpcValue(param.getSpcValue());
        
        return paramViewVO;
    }
    
    public static EquipmentRegisterVO changeRegisterVO(Equipment equipment) {
        EquipmentRegisterVO registerVO = new EquipmentRegisterVO();
        registerVO.setPkId(equipment.getPkId());
        registerVO.setEquipName(equipment.getEquipName());
        registerVO.setEquipCode(equipment.getEquipCode());
        registerVO.setEmSupplierId(equipment.getSupplier());
        registerVO.setEmModelType(equipment.getModelType());
        registerVO.setEmModel(equipment.getModelCode());
        registerVO.setEcRoute(equipment.getEcRoute());
//        registerVO.setOperationName(equipment.getOperationName());
        registerVO.setOperationId(equipment.getOperationId());
        registerVO.setType(equipment.getType());
        
//        registerVO.setPlcAddr(equipment.getPlcAddr());
//        registerVO.setFileAddr(equipment.getFileAddr());
//        registerVO.setDatabaseAddr(equipment.getDatabaseAddr());
//        registerVO.setUpperAddr(equipment.getUpperAddr());
        
        
        
        return registerVO;
    }
    
    public static CollectTerminalVO changeCollectTerminalVO(Client client) {
        CollectTerminalVO collectTerminalVO = new CollectTerminalVO();
        collectTerminalVO.setPkId(client.getPkId());
        collectTerminalVO.setClientCode(client.getClientCode());
        collectTerminalVO.setClientName(client.getClientName());
        
        collectTerminalVO.setEcAddress(client.getEcAddress());
        collectTerminalVO.setEcRoute(client.getClientAddress());
        collectTerminalVO.setOperationId(client.getOperationId());
        collectTerminalVO.setOperationName(client.getOperationName());
        return collectTerminalVO;
    }
    
    public static CollectTerminalVO changeCollectTerminalVO(Client client, int num) {
        CollectTerminalVO collectTerminalVO = new CollectTerminalVO();
        collectTerminalVO.setPkId(client.getPkId());
        collectTerminalVO.setClientCode(client.getClientCode());
        collectTerminalVO.setClientName(client.getClientName());
        collectTerminalVO.setEcAddress(client.getEcAddress());
        collectTerminalVO.setEcRoute(client.getClientAddress());
        collectTerminalVO.setOperationId(client.getOperationId());
        collectTerminalVO.setOperationName(client.getOperationName());
        
        
        collectTerminalVO.setIsHasEquipment(num>0);
        
        
        return collectTerminalVO;
    }

    
    /**
     * 
     * <p>Description: TODO</p>
     * @param equipment
     * @return
     */
    public static EquipmentStatusVO changeEquipmentStatusVO(Equipment equipment){
        EquipmentStatusVO vo =new EquipmentStatusVO();
        vo.setId(equipment.getPkId());
        vo.setName(equipment.getEquipName());
        vo.setCode(equipment.getEquipCode());
        vo.setImage(equipment.getImage());
        return vo;
    }

    
    public static EquipmentConnectVO changeEquipmentConnectVO(EquipmentToClient client) {
        EquipmentConnectVO equipConnectVO = new EquipmentConnectVO();
        equipConnectVO.setPkId(client.getPkId());
        equipConnectVO.setClientId(client.getClientId());
        equipConnectVO.setClientCode(client.getClientCode());
        equipConnectVO.setClientName(client.getClientName());
        equipConnectVO.setEquipCode(client.getEquipCode());
        equipConnectVO.setEquipName(client.getEquipName());
        
        
        equipConnectVO.setCommunicateAddr(client.getAddress());
        equipConnectVO.setType(client.getType());
        
        
        equipConnectVO.setEquipRemark(client.getRemark());
        equipConnectVO.setOperationName(client.getOperationName());
        equipConnectVO.setFrequency(client.getFrequency());
        equipConnectVO.setOperationId(client.getOperationId());
        equipConnectVO.setEquipmentId(client.getEquipId());
        
        equipConnectVO.setRemark(client.getRemark());
        
        return equipConnectVO;
    }
    
    
    public static EquipmentConnectVO changeEquipmentConnectVO(Client client) {
        EquipmentConnectVO connectVO = new EquipmentConnectVO();
        connectVO.setClientCode(client.getClientCode());
        connectVO.setClientName(client.getClientName());
        connectVO.setOperationId(client.getOperationId());
        connectVO.setOperationName(client.getOperationName());

        return connectVO;
   }
    


    public static EquipmentConnectVO changeEquipmentConnectVO(Client client, Equipment equipment) {
        EquipmentConnectVO connectVO = new EquipmentConnectVO();
        connectVO.setClientCode(client.getClientCode());
        connectVO.setClientName(client.getClientName());
        connectVO.setEquipRemark(equipment.getRemark());
        connectVO.setEquipCode(equipment.getEquipCode());
        connectVO.setEquipName(equipment.getEquipName());
        connectVO.setOperationId(client.getOperationId());
        connectVO.setOperationName(client.getOperationName());
//        connectVO.setCommunicateInter(equipment.getCommunicateInter());
//        connectVO.setFrequency(equipment.getFrequency());
        return connectVO;
   }

    public static EquipmentParamVO changeParamVO(CollectionParam param, EquipModel model) {
        EquipmentParamVO paramVO = new EquipmentParamVO();
        paramVO.setPkId(param.getPkId());
        paramVO.setModelCode(model.getModelCode());
        paramVO.setModelType(model.getModelType());
        paramVO.setParamName(param.getParamName());
        paramVO.setPlcAddr(param.getPlcAddr());
        paramVO.setProcessRange(param.getProcessRange());
        paramVO.setOperationId(param.getOperationId());
        paramVO.setOperationName(param.getOperationName());
        paramVO.setIsAutoAlarm(param.getIsAutoAlarm());
        paramVO.setAutoAlarmName(param.getAutoAlarmName());

        paramVO.setEnlargeNum(param.getEnlargeNum());
        paramVO.setDataType(param.getDataType());
        paramVO.setRwAttr(param.getRwAttr());


        paramVO.setDatabaseParamAddr(param.getDatabaseParamAddr());
        paramVO.setUpperDefinition(param.getUpperDefinition());
        paramVO.setUpperParamField(param.getUpperParamField());
        paramVO.setUpperParamName(param.getUpperParamName());
//        paramVO.setFileAddr(param.getFileAddr());
        paramVO.setFileColumn(param.getFileColumn());
        paramVO.setFileIgnoreFirst(param.getFileIgnoreFirst());
        paramVO.setFileName(param.getFileName());
        paramVO.setFileType(param.getFileType());
        paramVO.setCollectionType(param.getCollectionType());
        paramVO.setParamCode(param.getParamCode());
        paramVO.setSpcValue(param.getSpcValue());

        //新增参数

        paramVO.setAlarmCode(param.getAlarmCode());
        paramVO.setDataLength(param.getDataLength());
        paramVO.setParamField(param.getParamField());
        paramVO.setDecimalPos(param.getDecimalPos());
        paramVO.setDataTypeName(param.getDataTypeName());
        return paramVO;
    }

    public static EquipmentParamViewVO changeParamViewVO(CollectionParam param, EquipModel model) {
        EquipmentParamViewVO paramViewVO = new EquipmentParamViewVO();
        paramViewVO.setPkId(param.getPkId());
        paramViewVO.setEmModel(model.getModelCode());
        paramViewVO.setEmModelType(model.getModelType());
        paramViewVO.setParamName(param.getParamName());
        paramViewVO.setShowLevel(param.getShowLevel());
        paramViewVO.setStartValue(param.getStartValue());
        paramViewVO.setEndValue(param.getEndValue());
        paramViewVO.setStartThreshold(param.getStartThreshold());
        paramViewVO.setEndThreshold(param.getEndThreshold());
        paramViewVO.setSpcValue(param.getSpcValue());
        
        return paramViewVO;
    }

    public static EquipmentRegisterVO changeRegisterVO(Equipment equipment, EquipModel model) {
        EquipmentRegisterVO registerVO = new EquipmentRegisterVO();
        registerVO.setPkId(equipment.getPkId());
        registerVO.setEquipCode(equipment.getEquipCode());
        registerVO.setEquipName(equipment.getEquipName());
        registerVO.setEmModel(model.getModelCode());
        registerVO.setEmModelType(model.getModelType());
        registerVO.setEmSupplierId(model.getSupplier());
        registerVO.setEcRoute(model.getEcRoute());
        registerVO.setOperationId(equipment.getOperationId());
        
        registerVO.setType(equipment.getType());
//        registerVO.setPlcAddr(equipment.getPlcAddr());
//        registerVO.setFileAddr(equipment.getFileAddr());
//        registerVO.setUpperAddr(equipment.getUpperAddr());
//        registerVO.setDatabaseAddr(equipment.getDatabaseAddr());
        
        return registerVO;
    }

    public static EquipmentEnergyVO changeEnergyVO(EquipmentEnergy energy) {
        EquipmentEnergyVO energyVO = new EquipmentEnergyVO();
        energyVO.setPkId(energy.getPkId());
        energyVO.setCode(energy.getCode());
        energyVO.setEnergyName(energy.getEnergyName());
        energyVO.setEnergyUnit(energy.getEnergyUnit());
        energyVO.setBeginDegree(energy.getBeginDegree());
        energyVO.setCollectTime(energy.getCollectTime());
        energyVO.setType(energy.getType());
        energyVO.setWorkshop(energy.getWorkshop());
        energyVO.setShopName(energy.getShopName());
        energyVO.setOperationName(energy.getOperationName());
        energyVO.setOperationId(energy.getOperationId());
        return energyVO;
    }

    public static EquipmentEnergyRecordVO changeEnergyRecordVO(EquipmentEnergyRecord energy) {
        EquipmentEnergyRecordVO energyRecordVO = new EquipmentEnergyRecordVO();
        energyRecordVO.setPkId(energy.getPkId());
        energyRecordVO.setCode(energy.getCode());
        energyRecordVO.setType(energy.getType());
        energyRecordVO.setWorkshop(energy.getWorkshop());
        energyRecordVO.setOperationId(energy.getOperationId());
        energyRecordVO.setOperationName(energy.getOperationName());
        energyRecordVO.setEnergyName(energy.getEnergyName());
        energyRecordVO.setEnergyUnit(energy.getEnergyUnit());
        energyRecordVO.setValue(energy.getValue());
        energyRecordVO.setCreateDate(energy.getCreateDate());
        return energyRecordVO;
    }

    public static OperationVO changeOperationVO(SysOperation sysOperation) {
        OperationVO operationVO = new OperationVO();
        operationVO.setPkId(sysOperation.getPkId());
        operationVO.setCode(sysOperation.getCode());
        operationVO.setName(sysOperation.getName());
        //operationVO.setType(sysOperation.getType());
        operationVO.setCreateDate(sysOperation.getCreateDate());
        return operationVO;
    }

//    public static SysLogVO changeSysLogVO(SysLog sysLog) {
//        SysLogVO sysLogVO = new SysLogVO();
//        sysLogVO.setPkId(sysLog.getPkId());
//        sysLogVO.setCreateDate(sysLog.getCreateDate());
//        sysLogVO.setUserName(sysLog.getUserName());
//        sysLogVO.setModule(sysLog.getModule());
//        sysLogVO.setRouteIp(sysLog.getRouteIp());
//        sysLogVO.setRemark(sysLog.getRemark());
//        return sysLogVO;
//    }
    
    public static EqAutoAlarmDetailVO changeAlarmDetailVO(AutoAlarmRecord record){
        EqAutoAlarmDetailVO vo =new EqAutoAlarmDetailVO();
        vo.setEqCode(record.getEquipCode());
        vo.setOperationName(record.getOperationName());
        vo.setEqName(record.getEquipName());
        vo.setParamName(record.getParamName());
        vo.setParamValue(record.getAlarmValue());
        vo.setDate(record.getStartDate());
        vo.setAlarmName(record.getAlarmName()); 
        return vo;
    }
    

    public static EquipmentVideoVO changeEquipmentVideoVO(EquipmentVideo video) {
        EquipmentVideoVO videoVO = new EquipmentVideoVO();
        videoVO.setPkId(video.getPkId());
        videoVO.setCode(video.getCode());
        videoVO.setName(video.getName());
        videoVO.setModelName(video.getModelName());
        videoVO.setModelSupplier(video.getModelSupplier());
        videoVO.setResolution(video.getResolution());
        videoVO.setFrameRate(video.getFrameRate());
        videoVO.setCreateDate(video.getCreateDate());
        return videoVO;
    }

    public static EquipmentAlarmDefinitionVO changeEquipmentAlarmDefinitionVO(EquipAlarmParam alarmParam) {
        EquipmentAlarmDefinitionVO vo = new EquipmentAlarmDefinitionVO();
        vo.setPkId(alarmParam.getPkId());
        vo.setModelCode(alarmParam.getModelCode());
        vo.setEqCode(alarmParam.getEquipCode());
        vo.setEqName(alarmParam.getEqName());
        vo.setParamName(alarmParam.getParamName());
        vo.setParamUnit(alarmParam.getProcessRange());
        vo.setParamStandard(alarmParam.getStandardValue());

        /*StringBuilder sb =new StringBuilder();
        sb.append(">").append(alarmParam.getMinimaValue()).append("<").append(alarmParam.getMaximaValue());*/
        vo.setMaximaValue(alarmParam.getMaximaValue());
        vo.setMinimaValue(alarmParam.getMinimaValue());

//        vo.setParamRange(sb.toString());

        vo.setModelId(alarmParam.getModelId());
        vo.setParamPromptName(alarmParam.getPromptName());
        vo.setDate(alarmParam.getUpdateDate());

        return vo;
    }

    public static EquipmentAlarmRecordVO changeEquipmentAlarmRecordVO(AlarmRecord record) {
        EquipmentAlarmRecordVO vo = new EquipmentAlarmRecordVO();
        vo.setStartTime(record.getStartTime());
        vo.setEndTime(record.getEndTime());
        vo.setDuration(record.getDuration());
        vo.setProcessTime(record.getProcessTime());
        vo.setEqCode(record.getEqCode());
        vo.setEqName(record.getEqName());
        vo.setModelCode(record.getModelCode());
        vo.setParamName(record.getParamName());
        vo.setParamPromptName(record.getParamPromptName());
        vo.setPkId(record.getPkId());
        vo.setStatus(String.valueOf(record.getStatus()));
        vo.setUnit(record.getParamUnit());
        vo.setValue(String.valueOf(record.getErrorValue()));
        return vo;

    }
    
    public static SysLogVO changeSysLogVO(SysLog sysLog) {
        SysLogVO sysLogVO = new SysLogVO();
        sysLogVO.setPkId(sysLog.getPkId());
        sysLogVO.setCreateDate(sysLog.getCreateDate());
        sysLogVO.setUserName(sysLog.getUserName());
        sysLogVO.setModule(sysLog.getModule());
        sysLogVO.setRouteIp(sysLog.getRouteIp());
        sysLogVO.setRemark(sysLog.getRemark());
        return sysLogVO;
    }

	public static FactoryVO changeFactoryVO(Factory factory) {
		FactoryVO factoryVO = new FactoryVO();
		factoryVO.setPkId(factory.getPkId());
		factoryVO.setFactoryCode(factory.getFactoryCode());
		factoryVO.setFactoryName(factory.getFactoryName());
		factoryVO.setIdentifier(factory.getIdentifier());
		factoryVO.setRemark(factory.getRemark());
		return factoryVO;
	}

	public static ProductionLineVO changeProductionLineVO(ProductionLine productionLine) {
		ProductionLineVO productionLineVO = new ProductionLineVO();
		productionLineVO.setPkId(productionLine.getPkId());
		productionLineVO.setFactoryId(productionLine.getFactoryId());
		productionLineVO.setLineCode(productionLine.getLineCode());
		productionLineVO.setLineName(productionLine.getLineName());
		productionLineVO.setLineTag(productionLine.getIdentifier());
		productionLineVO.setOperationId(productionLine.getOperationId());
		productionLineVO.setOperationName(productionLine.getOperationName());
		productionLineVO.setFactoryName(productionLine.getFactoryName());
		productionLineVO.setRemark(productionLine.getRemark());
		return productionLineVO;
	}

	public static ShopVO changeShopVO(Shop shop) {
		ShopVO shopVO = new ShopVO();
		shopVO.setPkId(shop.getPkId());
		shopVO.setShopCode(shop.getShopCode());
		shopVO.setShopName(shop.getShopName());
		shopVO.setShopTag(shop.getIdentifier());
		shopVO.setFactoryName(shop.getFactoryName());
		
		shopVO.setOperationId(shop.getOperationId());
		shopVO.setOperationName(shop.getOperationName());
		shopVO.setLineId(shop.getLineId());
		shopVO.setLineName(shop.getLineName());
		shopVO.setRemark(shop.getRemark());
		return shopVO;
	}

	public static AreaVO changeAreaVO(Area area) {
		AreaVO areaVO = new AreaVO();
		areaVO.setPkId(area.getPkId());
		areaVO.setFactoryId(area.getFactoryId());
		areaVO.setFactoryName(area.getFactoryName());
		areaVO.setAreaCode(area.getAreaCode());
		areaVO.setAreaName(area.getAreaName());
		areaVO.setIdentifier(area.getIdentifier());
		areaVO.setRemark(area.getRemark());
		return areaVO;
	}

	public static PartVO changePartVO(Part part) {
		PartVO partVO = new PartVO();
		partVO.setKeyPartFlag(part.getKeyPartFlag());
		partVO.setMaxStock(part.getMaxStock());
		partVO.setMinStock(part.getMinStock());
		partVO.setModelCode(part.getModelCode());
		partVO.setNowStock(part.getNowStock());
		partVO.setPartCode(part.getPartCode());
		partVO.setPartName(part.getPartName());
		partVO.setPartSpecification(part.getPartSpecification());
		partVO.setPartType(part.getPartType());
		partVO.setPartUnit(part.getPartUnit());
		partVO.setPkId(part.getPkId());
		partVO.setQuickWearFlag(part.getQuickWearFlag());
		partVO.setSafeStock(part.getSafeStock());
		partVO.setShelfLife(part.getShelfLife());
		partVO.setStdAge(part.getStdAge());
		partVO.setLifeUnit(part.getLifeUnit());
		return partVO;
	}

	public static KeyPartVO changeKeyPartVO(KeyPart keyPart) {
		KeyPartVO keyPartVO = new KeyPartVO();
		keyPartVO.setoSerialNum(keyPart.getoSerialNum());
		keyPartVO.setPartCode(keyPart.getPartCode());
		keyPartVO.setPartName(keyPart.getPartName());
		keyPartVO.setPkId(keyPart.getPkId());
		keyPartVO.setReplaceNum(keyPart.getReplaceNum());
		keyPartVO.setStandardLife(keyPart.getStandardLife());
		keyPartVO.setStatus(keyPart.getStatus());
		keyPartVO.setLifeUnit(keyPart.getLifeUnit());
		return keyPartVO;
	}

	public static ModelpartsVO changeModelPartVO(ModelPart modelPart) {
		ModelpartsVO modelpartsVO= new ModelpartsVO();
		modelpartsVO.setLocationCode(modelPart.getLocationCode());
		modelpartsVO.setLocationName(modelPart.getLocationName());
		modelpartsVO.setPartCode(modelPart.getPartCode());
		modelpartsVO.setPartName(modelPart.getPartName());
		modelpartsVO.setPartType(modelPart.getPartType());
		modelpartsVO.setPkId(modelPart.getPkId());
		modelpartsVO.setRemark(modelPart.getRemark());
		return modelpartsVO;
	}

	public static PartReplaceVO changePartReplaceVO(PartReplace partReplace) {
		PartReplaceVO partReplaceVO = new PartReplaceVO();
		partReplaceVO.setLocationCode(partReplace.getLocationCode());
		partReplaceVO.setLocationName(partReplace.getLocationName());
		partReplaceVO.setnSerialNum(partReplace.getnSerialNum());
		partReplaceVO.setPartCode(partReplace.getPartCode());
		partReplaceVO.setPartName(partReplace.getPartName());
		partReplaceVO.setPkId(partReplace.getPkId());
		partReplaceVO.setRepDate(partReplace.getRepDate());
		partReplaceVO.setRepNum(partReplace.getRepNum());
		partReplaceVO.setRepReason(partReplace.getRepReason());
		partReplaceVO.setKeyPartFlag(partReplace.getKeyPartFlag());
		partReplaceVO.setoSeriId(partReplace.getoSeriId());
		return partReplaceVO;
	}

	public static MaintenanceItemVO changeItemVO(MaintenanceItem maintenanceItem) {
		MaintenanceItemVO maintenanceItemVO = new MaintenanceItemVO();
		maintenanceItemVO.setItemCode(maintenanceItem.getItemCode());
		maintenanceItemVO.setItemName(maintenanceItem.getItemName());
		maintenanceItemVO.setMaintenanceMethod(maintenanceItem.getMaintenanceMethod());
		maintenanceItemVO.setPkId(maintenanceItem.getPkId());
		maintenanceItemVO.setRemark(maintenanceItem.getRemark());
		maintenanceItemVO.setToolSupplies(maintenanceItem.getToolSupplies());
		maintenanceItemVO.setQualityItem(maintenanceItem.getQualityItem());
		maintenanceItemVO.setStopItem(maintenanceItem.getStopItem());
		return maintenanceItemVO;
	}

	public static MaintenanceTypeVO changeTypeAndItemVO(MaintenanceType maintenanceType) {
		MaintenanceTypeVO maintenanceTypeVO = new MaintenanceTypeVO();
		maintenanceTypeVO.setPkId(maintenanceType.getPkId());
		maintenanceTypeVO.setRemark(maintenanceType.getRemark());
		maintenanceTypeVO.setTypeAndItem(maintenanceType.getItemName());
		maintenanceTypeVO.setTypeCode(maintenanceType.getTypeCode());
		maintenanceTypeVO.setTypeName(maintenanceType.getTypeName());
		return maintenanceTypeVO;
	}

	public static PartRepSearchVO changePartReplaceAllVO(PartReplace partReplace) {
		PartRepSearchVO partRepSearchVO = new PartRepSearchVO();
		partRepSearchVO.setEquipCode(partReplace.getEquipCode());
		partRepSearchVO.setEquipName(partReplace.getEquipName());
		partRepSearchVO.setLocationName(partReplace.getLocationName());
		partRepSearchVO.setnSerialNum(partReplace.getnSerialNum());
		partRepSearchVO.setoSerialNum(partReplace.getoSerialNum());
		partRepSearchVO.setPartCode(partReplace.getPartCode());
		partRepSearchVO.setPartName(partReplace.getPartName());
		partRepSearchVO.setRemark(partReplace.getRemark());
		partRepSearchVO.setRepDate(partReplace.getRepDate());
		partRepSearchVO.setRepReason(partReplace.getRepReason());
		partRepSearchVO.setRepUser(partReplace.getRepUser());
		partRepSearchVO.setRepNum(partReplace.getRepNum());
		return partRepSearchVO;
	}

	public static MaintenancePlanVO changeModelPlanVO(MaintenancePlan plan) {
		MaintenancePlanVO maintenancePlanVO = new MaintenancePlanVO();
		maintenancePlanVO.setMaintainCycle(plan.getMaintainCycle());
		maintenancePlanVO.setMaintainUserName(plan.getMaintainUserName());
		maintenancePlanVO.setMaintainUserWorkNo(plan.getMaintainUserWorkNo());
		maintenancePlanVO.setPkId(plan.getPkId());
		maintenancePlanVO.setPlanStatus(plan.getPlanStatus());
		maintenancePlanVO.setRemark(plan.getRemark());
		maintenancePlanVO.setStartDate(plan.getStartDate());
		maintenancePlanVO.setTypeCode(plan.getTypeCode());
		maintenancePlanVO.setTypeName(plan.getTypeName());
		return maintenancePlanVO;
	}

	public static MaintenanceTaskVO changeTaskVO(MaintenanceTask maintenanceTask) {
		MaintenanceTaskVO maintenanceTaskVO = new MaintenanceTaskVO();
		maintenanceTaskVO.setEquipCode(maintenanceTask.getEquipCode());
		maintenanceTaskVO.setEquipName(maintenanceTask.getEquipName());
		maintenanceTaskVO.setFactoryName(maintenanceTask.getFactoryName());
		maintenanceTaskVO.setLastDate(maintenanceTask.getLastDate());
		maintenanceTaskVO.setLineName(maintenanceTask.getLineName());
		maintenanceTaskVO.setLocationName(maintenanceTask.getLocationName());
		maintenanceTaskVO.setMaintainCycle(maintenanceTask.getMaintainCycle());
		maintenanceTaskVO.setModelType(maintenanceTask.getModelType());
		maintenanceTaskVO.setNextDate(maintenanceTask.getNextDate());
		maintenanceTaskVO.setPkId(maintenanceTask.getPkId());
		maintenanceTaskVO.setShopName(maintenanceTask.getShopName());
		maintenanceTaskVO.setSupplier(maintenanceTask.getSupplier());
		maintenanceTaskVO.setTypeCode(maintenanceTask.getTypeCode());
		maintenanceTaskVO.setPlanId(maintenanceTask.getPlanId());
		maintenanceTaskVO.setStopItem(maintenanceTask.getStopItem());
		maintenanceTaskVO.setMaintainUserName(maintenanceTask.getMaintainUserName());
		return maintenanceTaskVO;
	}

	public static TPReplaceTempVO changeReplaceTempVO(TPReplaceTemp tPReplaceTemp) {
		TPReplaceTempVO tPReplaceTempVO = new TPReplaceTempVO();
		tPReplaceTempVO.setPkId(tPReplaceTemp.getPkId());
		tPReplaceTempVO.setPlanId(tPReplaceTemp.getPlanId());
		tPReplaceTempVO.setCode(tPReplaceTemp.getCode());
		tPReplaceTempVO.setLocationCode(tPReplaceTemp.getLocationCode());
		tPReplaceTempVO.setLocationName(tPReplaceTemp.getLocationName());
		tPReplaceTempVO.setName(tPReplaceTemp.getName());
		tPReplaceTempVO.setnCode(tPReplaceTemp.getCode());
		tPReplaceTempVO.setnSerialNum(tPReplaceTemp.getnSerialNum());
		tPReplaceTempVO.setNum(tPReplaceTemp.getNum());
		tPReplaceTempVO.setoCode(tPReplaceTemp.getoCode());
		tPReplaceTempVO.setoSerialNum(tPReplaceTemp.getoSerialNum());
		tPReplaceTempVO.setUseFlag(tPReplaceTemp.getUseFlag());
		tPReplaceTempVO.setType(tPReplaceTemp.getType());
		return tPReplaceTempVO;
	}

	public static MaintenanceRecordVO changeTaskRecordVO(MaintenanceRecord maintenanceRecord) {
		MaintenanceRecordVO  maintenanceRecordVO = new MaintenanceRecordVO();
		maintenanceRecordVO.setEquipCode(maintenanceRecord.getEquipCode());
		maintenanceRecordVO.setEquipName(maintenanceRecord.getEquipName());
		maintenanceRecordVO.setFactoryName(maintenanceRecord.getFactoryName());
		maintenanceRecordVO.setLastDate(maintenanceRecord.getCreateDate());//保养时间
		maintenanceRecordVO.setLineName(maintenanceRecord.getLineName());
		maintenanceRecordVO.setAreaName(maintenanceRecord.getAreaName());
		maintenanceRecordVO.setMaintainCycle(maintenanceRecord.getMaintainCycle());
		maintenanceRecordVO.setModelType(maintenanceRecord.getModelType());
		maintenanceRecordVO.setPkId(maintenanceRecord.getPkId());
		maintenanceRecordVO.setShopName(maintenanceRecord.getShopName());
		maintenanceRecordVO.setSupplier(maintenanceRecord.getSupplier());
		maintenanceRecordVO.setTypeCode(maintenanceRecord.getTypeCode());
		maintenanceRecordVO.setConfirmDate(maintenanceRecord.getConfirmDate());
		if(maintenanceRecord.getConfirmResult()!=null){
			maintenanceRecordVO.setConfirmResult(maintenanceRecord.getConfirmResult().toString());
		}
		maintenanceRecordVO.setConfirmUser(maintenanceRecord.getConfirmUser());
		maintenanceRecordVO.setStatus(maintenanceRecord.getStatus());
		maintenanceRecordVO.setMaintainTimeSpan(maintenanceRecord.getMaintainTimeSpan());
		maintenanceRecordVO.setMaintainUserName(maintenanceRecord.getCreateUser());
		maintenanceRecordVO.setType(maintenanceRecord.getType());
		return maintenanceRecordVO;
	}

	public static MaintenanceItemRecordVO changeItemRecordVO(MaintenanceItem maintenanceItem) {
		MaintenanceItemRecordVO maintenanceItemRecordVO = new MaintenanceItemRecordVO();
		maintenanceItemRecordVO.setItemCode(maintenanceItem.getItemCode());
		maintenanceItemRecordVO.setItemName(maintenanceItem.getItemName());
		maintenanceItemRecordVO.setMaintenanceMethod(maintenanceItem.getMaintenanceMethod());
		maintenanceItemRecordVO.setMaintenanceResult(maintenanceItem.getMaintenanceResult());
		maintenanceItemRecordVO.setMaintainTimeSpan(maintenanceItem.getMaintainTimeSpan());
		maintenanceItemRecordVO.setPkId(maintenanceItem.getPkId());
		maintenanceItemRecordVO.setRemark(maintenanceItem.getRemark());
		maintenanceItemRecordVO.setQualityItem(maintenanceItem.getQualityItem());
		maintenanceItemRecordVO.setStopItem(maintenanceItem.getStopItem());
		return maintenanceItemRecordVO;
	}

	public static MaintenanceTypeItemVO changeTypeItemVO(MaintenanceItem maintenanceItem,List<MTypeItem> typeItems) {
		MaintenanceTypeItemVO maintenanceItemVO = new MaintenanceTypeItemVO();
		maintenanceItemVO.setItemCode(maintenanceItem.getItemCode());
		maintenanceItemVO.setItemName(maintenanceItem.getItemName());
		maintenanceItemVO.setMaintenanceMethod(maintenanceItem.getMaintenanceMethod());
		maintenanceItemVO.setPkId(maintenanceItem.getPkId());
		maintenanceItemVO.setQualityItem(maintenanceItem.getQualityItem());
		maintenanceItemVO.setStopItem(maintenanceItem.getStopItem());
		maintenanceItemVO.setRemark(maintenanceItem.getRemark());
		maintenanceItemVO.setToolSupplies(maintenanceItem.getToolSupplies());
		if(!typeItems.isEmpty()) {
			for(MTypeItem mTypeItem : typeItems) {
				if(maintenanceItem.getPkId().equals(mTypeItem.getItemId())) {
					maintenanceItemVO.setChecked("1");
				}
			}
		}
		return maintenanceItemVO;
	}


}
